import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.ParseException;

public class SqlTool {

    public static String url =
            "jdbc:mysql://localhost:3306/reindex?useUnicode=true&characterEncoding=utf-8&useSSL=false";
    public static String user = "root";
    public static String password = "123456";
    public static void CreateTable() throws ClassNotFoundException,
            IOException, SQLException, ParseException {

        String createBrandDatabase = "create table record (url_id varchar(255) not null,url varchar(255) not null)charset=utf8";
        String checkTable="show tables like \"record\"";
        try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection con =  DriverManager.getConnection(url,
                    user, password);
            Statement stmt = con.createStatement();

            ResultSet resultSet=stmt.executeQuery(checkTable);
            if (resultSet.next()) {
                System.out.println("table exist!");
            }else{
        if(stmt.executeUpdate(createBrandDatabase)==0)
                    System.out.println("create table success!");
            }

        } finally {

        }

    }


    public static void main(String[] args) {

    long a=20l;
    long b=5l;
        double progress = b/(double)a;
        System.out.printf("%.2f\n", progress);
    }


}
